﻿/*手机验证*/
var telCheck = /^[1](([3][0-9])|([4][5-9])|([5][0-3,5-9])|([6][5,6])|([7][0-8])|([8][0-9])|([9][1,8,9]))[0-9]{8}$/
//邮编
var postCode_check = /((0[^089])|([^0]\d))\d{4}/

function checkAll() {
    if(!$('#Addr').val()) {
        $('#Addr').parent().siblings('.tips').html('请完善地址信息')
        $('#areaLabel').css({borderColor: '#ff0036'})
        return
    }
    if(!$('#detailAddr').val()) {
        $('#detailAddr').siblings('.tips').html('请填写详细地址')
        $('#detailAddr').css({borderColor: '#ff0036'})
        $('#detailAddr').focus()
        return
    }
    if($('#postCode').val() && !postCode_check.test($('#postCode').val())) {
        $('#postCode').parent().siblings('.tips').html('请填写正确的邮编')
        $('#postCode').css({borderColor: '#ff0036'})
        $('#postCode').focus()
        return
    }
    if(!$('#consigneeName').val()) {
        $('#consigneeName').parent().siblings('.tips').html('请输入收货人姓名')
        $('#consigneeName').css({borderColor: '#ff0036'})
        $('#consigneeName').focus()
        return
    }
    if(!$('#phone').val()) {
        $('#phone').parent().siblings('.tips').html('请输入手机号')
        $('#phone').css({borderColor: '#ff0036'})
        $('#phone').focus()
        return
    }else if(!telCheck.test($('#phone').val())) {
        $('#phone').parent().siblings('.tips').html('请输入正确的手机号')
        $('#phone').css({borderColor: '#ff0036'})
        $('#phone').focus()
        return
    }
    $('.tips').html('')
    $(':text').css({borderColor: '#c4c6cf'})
}